window.BASEPATH = "http://localhost:8080/";
window.CommonUtil = {
    dateFormatter: function (value, row, index) {
        var date = new Date(value);
        return CommonUtil.myFormatter(date);
    },
    getMillisecond: function (s) {
        var t = Date.parse(s);
        if (!isNaN(t)) {
            return t;
        } else {
            return 0;
        }
    },
    myFormatter: function (date) {
        var year = date.getFullYear();
        var month = date.getMonth() + 1;
        if (month < 10) {
            month = "0" + month;
        }
        var day = date.getDate();
        if (day < 10) {
            day = "0" + day;
        }
        var hour = date.getHours();
        if (hour < 10) {
            hour = "0" + hour;
        }
        var minute = date.getMinutes();
        if (minute < 10) {
            minute = "0" + minute;
        }
        var second = date.getSeconds();
        if (second < 10) {
            second = "0" + second;
        }

        return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
    },
    myParser: function (s) {
        var t = Date.parse(s);
        if (!isNaN(t)) {
            return new Date(t);
        } else {
            return new Date();
        }
    },
    shopFormatter: function (value, row, index) {
        var rtn = "";
        $.each(window.Shop_Data, function (ix, item) {
            if (item.id == value) {
                rtn = item.text;
                return;
            }
        });
        return rtn;
    },
    platformFormatter: function (value, row, index) {
        var rtn = "";
        $.each(window.Platform_Data, function (ix, item) {
            if (item.id == value) {
                rtn = item.text;
                return;
            }
        });
        return rtn;
    },
    OrderStatusFormatter: function (value, row, index) {
        var rtn = "";
        $.each(window.OrderStatus_Data, function (ix, item) {
            if (item.id == value) {
                rtn = item.text;
                return;
            }
        });
        return rtn;
    }
}